

       /*
        * ECMAScript supports anonymous functions, sometimes referred
        * to as lamdas. Lambdas can be defined in such a way as to self
        * execute upon definition, but most commonly they are defined and
        * assigned to a variable, as below
        */
       var lamda= function () 
       {
           
       };
       
       /*
        * ECMAScript also supports named functions. When you define a function
        * with a name, a variable does not need to be assigned to reference
        * it, you just reference it by its name
        */
       function namedMethod () 
       {
           
       };
       
       /* 
        * Its not overly common, but you can also create a reference to a
        * named function just as you would with a lambda.
        */
       var referenceToNamedFunction= function qwerty () {};
       
       
       alert(lambda.getName()); // 'anonymous'
       alert(namedMethod.getName()); // 'namedMethod'
       alert(referenceToNamedFunction.getName()); // 'qwerty'
       
       
       /*
        * Below, an Object literal trait implementation style- a method named
        * 'method' is defined by supplying an object literal to the 
        * implement method. The object literal has a property named 'method'
        * which refers to a lambda, and it is the name of this property
        * that is used to assign the function to constructors prototype
        */
       
       HashTraitsExample.implement
       (
           {
               method: function () 
               {
                   return true;
               }   
           }
       );
       
       function HashTraitsExample () {;};
       
       /*
        * A named method is supplied directly as an argument to the implement
        * method- its name is reflected via Function.prototype.getName then
        * added to the constructors prototype by that name
        */
       NamedMethodExample.implement
       (
            function method () 
            {
                return true;
            }
       );
        
       function NamedMethodExample () {;};
       
       /*
        * Which is better? From an aesthetic perspective,  my personal choice
        * is the named method example. I think it preserves the semantic meaning
        * of the object definition, and is easier to read.
        * 
        * However, there is a caveat- if you are planning to use a JavaScript
        * compressor such as YUICompressor or Google Closure Compiler to do more
        * than just white space compression, neither will preserve the names
        * of functions supplied as arguments, so your code will not survive
        * optimisation.
        * 
        * On the otherhand, the object literal style WILL survive optimisation
        * by both compressors.
        * 
        * Personally, I would like to see both compressors having a 'preserve
        * function names' directive, but unfortunately, neither do :(
        * 
        * ... unless you'd like to bug them about it as well?! :)
        * 
        * And one more thing.... you should be aware of the following potential
        * pitfall
        */
       
       var x= function namedFunction () {}
       ,   y= function () {};
       
       ExampleClass.implement
       (
           x
           
       ,   y
       
       );
       function ExampleClass () {;};    
       
       /*
        * In the above example, both functions assigned to the variables
        * x and y are supplied to the implement method as function arguments.
        * As a result, the function names will be used, and not the variable
        * names, and in the case of x, which is an anonymous function, it will
        * be ignored, while y will be added to ExampleClass.prototype by the name
        * 'namedFunction'
        * 
        * Functions supplied to the implement method via an object literal
        * will always be named by property names, regardless of function names,
        * so in the example below, they will be added to the
        * constructors prototype by the names 'x' and 'y'
        */
       
       ExampleClassTwo.implement
       (
           {
               x: x
           ,   y: y
           }
       );
       
       function ExampleClassTwo () {;};
       